<template>
  <div class="acction">
    <el-tabs>
      <el-table v-model="formiinst" :data="list" style="width: 100%">
        <el-table-column label="反馈信息" prop="desc" width="500">
        </el-table-column>
        <el-table-column label="发布者" prop="userNick" style="width: 20%">
        </el-table-column>
        <el-table-column label="发布时间" prop="publicTime" style="width: 20%">
          <template v-slot="{ row }">
            {{ formatdata(row.publicTime) }}
          </template>
        </el-table-column>
        <el-table-column label="操作">
          <template v-slot="{ row }">
            <el-button type="text" @click="hcouent(row)">查看详细</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 查看详细弹出框 -->
      <el-dialog title="建议与反馈" :visible.sync="dialogVisible" width="20%">
        <el-input
          type="textarea"
          :autosize="{ maxRows: 4 }"
          v-model="textarea1.desc"
        >
        </el-input>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">关 闭</el-button>
        </span>
      </el-dialog>
      <el-pagination
        class="liyongxin"
        :current-page.sync="q.index"
        :page-sizes="[ 10, 15, 20]"
        :page-size="5"
      
        layout=" sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
      </el-pagination>
    </el-tabs>
  </div>
</template>

<script>
import { usersuggest } from "@/api/user";
import dayjs from "dayjs";
export default {
  data() {
    return {
      dialogVisible: false,
      list: [],
formiinst:{},
      q: {
        index: 1,
        size: 10
      },
      textarea1: {
        desc: "",
      },
    };
  },
  created() {
    this.loasuggest();
  },
  methods: {
    async loasuggest() {
      const res = await usersuggest(this.q);

      this.list = res.data;
    },
    // 查看详细
    hcouent(row) {
      this.dialogVisible = true;
      this.textarea1 = { ...row };
    },
    // 时间
    formatdata(data) {
      return dayjs(data).format("YYYY-MM-DD");
    },
    // 分页
    handleCurrentChange(index) {
      this.q.index = index;
      this.loasuggest();
    },
    handleSizeChange(size) {
      this.q.size = size;
      this.loasuggest();
    },
  },
};
</script>

<style scoped>
.acction {
  background-color: #fff;
  padding: 20px;
}
.el-button--text {
  color: #ff7144;
}
</style>
